<template>
  <div class='tabDeviceInfo'>
  </div>
</template>

<script>

import * as api from '@/api/link/device'

export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {
      deviceId: null,
      deviceInfo: null,
      tableData: [{}],
      dialogVisible: false,
      curTitle: "新增属性",
      formInline: {
        name: '',
        value: ''
      },
      rules: {
        name: [
          { required: true, message: '请填写属性名称', trigger: 'blur' }
        ],
        value: [
          { required: true, message: '请填写属性值', trigger: 'blur' }
        ],
      }
    }
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {
    this.deviceId = this.$route.query.deviceId
    this.get()
  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() { },
  methods: {
    handleAdd() {
      this.dialogVisible = true
      this.curTitle = '新增属性'
    },
    handleEdit(row) {
      this.dialogVisible = true
      this.curTitle = '编辑属性'
    },
    onCanle(row) {
      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    handleSave(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert('submit!');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    get(){
      api.get({"deviceId": this.deviceId}).then(resp => {
        this.deviceInfo = resp.data;
      })
    }
  },
}
</script>
<style lang='scss' scoped>
.tabDeviceInfo {
  padding: 10px;
  .curTable {
    border: solid #cdd7e2;
    border-width: 1px 0px 0px 1px;
    tr {
      td {
        border: solid #cdd7e2;
        border-width: 0px 1px 1px 0px;
        padding-left: 10px;
        line-height: 2;
        background-color: #eef1f6;
        color: #687b91;
        font-size: 12px;
      }
    }
  }
}
</style>
